package com.myroad.test;

import java.io.IOException;
import java.io.UnsupportedEncodingException;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.DefaultHttpClient;

import com.sharepics.bean.Album;
import com.thoughtworks.xstream.XStream;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		XStream xstream = new XStream();
		Album album = new Album();
    	String xml = xstream.toXML(album);
    	
    	HttpClient httpClient = new DefaultHttpClient();
		HttpPost postRequest = new HttpPost(
				"http://10.0.2.2:8231/ws/albums/");
    	
		try {
			postRequest.setEntity(new StringEntity(xml));
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
		HttpResponse response = null;
		try {
			response = httpClient.execute(postRequest);
		} catch (ClientProtocolException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}

	}

}
